<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath+"admin" + "/"%>">    
    <title>编辑页面广告</title>
    <link rel="stylesheet" type="text/css" href="skin/css/base.css">
    <script type="text/javascript">   	
    	function doUpdate()
    	{
    		if(document.pageAdFM.pageId.value == 255)
    		{
    			alert("请选择页面标题!");
    			return;
    		}
    		if(document.pageAdFM.adId.value == 255)
    		{
    			alert("请选择广告标题!");
    			return;
    		}
    		if(document.pageAdFM.layout.value == 255)
    		{
    			alert("请选择广告位置!");
    			return;
    		}
    		
    		document.pageAdFM.submit();
    	}
    </script>
  </head>  
  <body leftmargin="8" topmargin="8" background='skin/images/allbg.gif'>
		<!--  内容列表   -->
		<form name="pageAdFM" action="<%=path%>/admin/pageAdMgr.do" method="post">
			<input type="hidden" name="action_method" value="update">			
			<input type="hidden" name="pageAdId" value="${pageAd.id}">
			<table width="98%" border="0" cellpadding="2" cellspacing="1"
				bgcolor="#D1DDAA" align="center" style="margin-top: 8px">
				<tr bgcolor="#E7E7E7">
					<td height="24" colspan="2" background="skin/images/tbg.gif">
						&nbsp;页面广告列表&nbsp;
					</td>
				</tr>
				<tr height="22">
					<td width="8%" bgcolor="#FAFAF1" align="right">
						ID
					</td>
					<td width="96%" bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';" onmouseout="javascript:this.bgColor='#FFFFFF';">
						${pageAd.id}
					</td>
				</tr>
				<tr height="22">
					<td width="8%" bgcolor="#FAFAF1" align="right">
						页面标题
					</td>
					<td width="96%" bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';" onmouseout="javascript:this.bgColor='#FFFFFF';">
						<select name="pageId">
							<option value="255">-- 请选择 --</option>
							<c:forEach var="contentsColl" items="${contents}">
								<option value="${contentsColl.id}" <c:if test="${pageAd.pageId == contentsColl.id }"><%="selected"%></c:if>>${contentsColl.title}</option>
							</c:forEach>
						</select>
					</td>
				</tr>
				<tr height="22">
					<td width="8%" bgcolor="#FAFAF1" align="right">
						广告标题
					</td>
					<td width="96%" bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';" onmouseout="javascript:this.bgColor='#FFFFFF';">
						<select name="adId">
							<option value="255">-- 请选择 --</option>
							<c:forEach var="adsColl" items="${ads}">								
								<option value="${adsColl.id}" <c:if test="${pageAd.adId == adsColl.id }"><%="selected"%></c:if>>${adsColl.title}</option>
							</c:forEach>
						</select>
					</td>
				</tr>			
				<tr height="22">
					<td width="8%" bgcolor="#FAFAF1" align="right">
						广告位置
					</td>
					<td width="96%" bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';" onmouseout="javascript:this.bgColor='#FFFFFF';">
						<select name="layout">
							<option value="255">-- 请选择 --</option>
							<option value="H" <c:if test="${pageAd.layout == 0 }"><%="selected"%></c:if>>Header</option>
							<option value="F" <c:if test="${pageAd.layout == 1 }"><%="selected"%></c:if>>Footer</option>
						</select>
					</td>
				</tr>								
				
				<tr bgcolor="#FAFAF1">
					<td height="35" colspan="10">
						&nbsp;
						<input class="coolbg" type="button" value="更新" onclick="doUpdate()"/>					
					</td>
				</tr>			
			</table>
		</form>		
	</body>
</html>
